From: Georges Basile Stavracas Neto Date: Fri, 27 Nov 2020 14:07:03 +0000 (-0300) Subject: overviewControls: Simplify DashSpacer X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~709 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c9a6424f2e652e6e17afe0484fbe9c7d413ac40e;p=gnome-shell.git overviewControls: Simplify DashSpacer Make it subclass ClutterActor, since we don't need any of StWidget's features. Pass the source actor of the bind constraint in the constructor, and remove the extra method to set the source actor. Part-of: --- diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index 3d313e7d4..9d18d82f8 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -361,24 +361,15 @@ class DashSlider extends SlidingControl { }); var DashSpacer = GObject.registerClass( -class DashSpacer extends St.Widget { - _init(params) { - super._init(params); - - this._bindConstraint = null; - } +class DashSpacer extends Clutter.Actor { + _init(source) { + super._init(); - setDashActor(dashActor) { - if (this._bindConstraint) { - this.remove_constraint(this._bindConstraint); - this._bindConstraint = null; - } - - if (dashActor) { - this._bindConstraint = new Clutter.BindConstraint({ source: dashActor, - coordinate: Clutter.BindCoordinate.SIZE }); - this.add_constraint(this._bindConstraint); - } + this._bindConstraint = new Clutter.BindConstraint({ + source, + coordinate: Clutter.BindCoordinate.SIZE, + }); + this.add_constraint(this._bindConstraint); } vfunc_get_preferred_width(forHeight) { @@ -406,8 +397,7 @@ class ControlsManager extends St.Widget { this.dash = new Dash.Dash(); this._dashSlider = new DashSlider(this.dash); - this._dashSpacer = new DashSpacer(); - this._dashSpacer.setDashActor(this._dashSlider); + this._dashSpacer = new DashSpacer(this._dashSlider); let workspaceManager = global.workspace_manager; let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();